import React, { Component } from 'react'
import '../assets/style/input.less'
export default class Input extends Component {
    state = {
        value: ''
    }
    myref = React.createRef()
    change = (event) => {
        this.setState({
            value: event.target.value
        })
    }

    render() {
        let checked = this.props.checked ? true : false
        return (
            <>
                {this.props.start ? <span style={{ marginLeft: "5px", marginRight: "5px" }}>{this.props.start}</span> : ""}
                <input className={"input_less " + this.props.className}
                    type={this.props.type}
                    placeholder={this.props.placeholder}
                    onFocus={this.props.onFocus}
                    onBlur={this.props.onBlur}
                    defaultValue={this.props.value}
                    name={this.props.name}
                    onClick={this.props.onClick}
                    onChange={this.change}
                    checked={checked}
                    ref={(e) => {
                        if (this.props.getfocus) {
                            this.props.getfocus(e)
                        }
                    }}
                />
                {this.props.end ? <span style={{ marginLeft: "5px", marginRight: "5px" }}>{this.props.end}</span> : ""}
            </>
        )
    }
}
